home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: TRUE & FALSE
- Sent: 4/22/96 3:50 PM
- Received: 4/22/96 5:11 PM
- From: Jim Lloyd, jim@melongem.com
- Reply-To: ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- At 2:45 PM 4/22/96, Gary Ashcraft wrote:
- >ODF Team,
- >
- >For booleans, ODF defines TRUE and FALSE. OpenDoc uses kODTrue and
- >kODFalse. The CW IDE indicates that true and false are boolean keywords.
- >
- >I see in FWStdDef.h that TRUE = 1 and FALSE = 1; the OpenDoc class
- >reference says that "the size of a boolean type is platform-dependant";
- >then says that kODTrue = True and kODFalse = False.
- >
- >Could you explain the reasoning for defining new booleans instead of just
- >using the ones provided by OpenDoc?
-
- For ODF R1, we came very close to just using the definitions provided by
- the proposed ANSI/ISO standard (i.e. bool, true, false). We had even
- changed FW_Boolean to bool in most of the sources. However, in the end we
- decided we had to have a definition that we had control over. As you
- mentioned, the OpenDoc class reference says the size of the boolean type is
- platform-dependent. We need to have a well-understood definition because
- we do things like this:
-
- FW_Boolean flag;
- FW_CReadableStream stream;
- stream >> flag;
-
- The number of bytes read from the stream is dependent on the definition of
- FW_Boolean. Because of this, we need a definition that is unambiguous now
- and in the future.
-
- Note that you are pretty much free to use whichever symbolic constants you
- want. The existing definitions of true, false, kODTrue, kODFalse, TRUE, and
- FALSE are are consistent when used in logical expressions. The only
- problems that occur have to do with assumptions made concerning size of
- arguments.
-
- Jim Lloyd
- ODF Team
-
-